﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITQUIZ
{
    public class Question : QuestionsList
    {

        Answer ans = new Answer();
        CorrectAnswer correctAns = new CorrectAnswer();

        public static string ReturnQuestion(string path, int questionNumber)
        {
            string[] questions = ReadQuestionsFile(path);
            return questions[questionNumber];
        }

        //DIRTY HACK
        //IN ORDER TO AVOID VIOLATING THE DRY PRINCIPLE THE FOLLOWING HACK WAS IMPLEMENTED
        //INSTEAD OF MAKING MULTIPLE METHODS DOING THE SAME, EXCEPT FOR DIFFERENT FILES IT WAS DECIDED TO IMPLEMENT A "GENERAL PATH"
        //TO WHICH LATER WILL BE ADDED A,B,C OR D (DEPENDING ON THE CHOICE) TO GET THE REAL FILE PATH
        protected string[] GetAnswer(int questionNumber, string generalPath)
        {

            const int numberOfAnswers = 4;
            string[] answers = new string[numberOfAnswers+1];
            for (int i = 1; i <= numberOfAnswers; i++)
            {
                string currentPath = generalPath + i.ToString() + ".txt";
                answers[i] = ans.ReturnAnswer(currentPath, questionNumber);
            }

            return answers;
        }

        protected int ReturnQuestionCorrectAnswer(string path, int questionNumber)
        {
            return correctAns.GetCorrectAnswer(path, questionNumber);
           
        }
        



    }
}
